<template>
  <div class="xy-card">
    <div
      class="xy-card_header"
      v-if="hasHeader"
    >
      <div class="clearfix">
        <slot name="header"></slot>
      </div>
    </div>
    <div
      class="xy-card_body"
      v-if="hasDefault"
    >
      <slot />
    </div>
  </div>
</template>
<script>
export default {
  computed:{
    hasHeader(){
      // console.log(this.$slots);
      return this.$slots["header"];
    },
    hasDefault(){
      return this.$slots["default"];
    }
  },
  created(){
  }
};
</script>
<style lang="less" scoped>
.xy-card {
  background-color: white;
  border: 1px solid rgb(235, 238, 245);
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid #ebeef5;
  background-color: #fff;
  color: #303133;
  transition: 0.3s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  .xy-card_body {
    padding: 1rem;
    flex: 1;
  }
  .xy-card_header {
    padding: 18px 20px;
    border-bottom: 1px solid #ebeef5;
    box-sizing: border-box;
  }
  .clearfix {
    // visibility: hidden;
    // display: block;
    // font-size: 0;
    // content: " ";
    clear: both;
    // height: 0;
  }
}
</style>
